package com.eshang.test.json.controller;

import com.eshang.test.json.entity.Office;
import com.eshang.test.json.entity.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("controller")
public class UserController {

	User user = new User();

	@RequestMapping("testJson")
	public Office testJson() {
		user.setUserName("xyx");
		user.setUserAge(16);
		user.setUserSex(true);

		Office office = new Office();
		List<User> users = new ArrayList<>();
		for (int i = 0; i < 6; i++) {
			users.add(user);
		}
		office.setUsers(users);
		return office;
	}
}
